package au.com.introprogexercise.core.tests;

import au.com.introprogexercise.core.excercises.PrimeFactorExercise;
import org.junit.Assert;
import org.junit.Test;

/**
 * Created by olga on 31/05/14.
 */
public class PrimeFactorExerciseTest
{
    @Test
    public void testIfPrimeFactorOfOneIsEmpty()
    {
        Integer[] expectedResult = {};
        Assert.assertArrayEquals(expectedResult, PrimeFactorExercise.generate(1));
    }

    @Test
    public void testIfPrimeFactorOfFiveIsZero()
    {
        Integer[] expectedResult = {};
        Assert.assertArrayEquals(expectedResult, PrimeFactorExercise.generate(5));
    }

    @Test
    public void testIfPrimeFactorOfThreeIsZero()
    {
        Integer[] expectedResult = {};
        Assert.assertArrayEquals(expectedResult, PrimeFactorExercise.generate(3));
    }

    @Test
    public void testIfPrimeFactorOfTenIsTwoFive()
    {
        Integer[] expectedResult = {2,5};
        Assert.assertArrayEquals(expectedResult, PrimeFactorExercise.generate(10));
    }

    @Test
    public void testIfPrimeFactorOfThirtyIsTwoThreeFive()
    {
        Integer[] expectedResult = {2,3,5};
        Assert.assertArrayEquals(expectedResult, PrimeFactorExercise.generate(30));
    }

    @Test
    public void testIfPrimeFactorOfFiftyIsTwoFiveFive()
    {
        Integer[] expectedResult = {2,5,5};
        Assert.assertArrayEquals(expectedResult, PrimeFactorExercise.generate(50));
    }

    @Test
    public void testIfPrimeFactorOfThirtyNineIsthreeThirteen()
    {
        Integer[] expectedResult = {3,13};
        Assert.assertArrayEquals(expectedResult, PrimeFactorExercise.generate(39));
    }

    @Test
    public void testIfPrimeFactorOfTwohundredAndFortythreeIs()
    {
        Integer[] expectedResult = {3,3,3,3,3};
        Assert.assertArrayEquals(expectedResult, PrimeFactorExercise.generate(243));
    }
}
